package com.zhentao.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhentao.mapper.YhjMapper;
import com.zhentao.model.common.dtos.PageResponseResult;
import com.zhentao.model.common.dtos.ResponseResult;
import com.zhentao.model.common.dtos.YhjDTO;
import com.zhentao.model.common.pojo.yhj.Yhj;
import com.zhentao.service.IYhjService;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author mp
 * @since 2024-12-17
 */
@Service
public class YhjServiceImpl extends ServiceImpl<YhjMapper, Yhj> implements IYhjService {

    @Override
    public ResponseResult pageYhj(YhjDTO yhjDTO) {
        IPage<Yhj> page = new Page<>(yhjDTO.getPageNum(), yhjDTO.getPageSize());
        this.page(page);
        PageResponseResult result = new PageResponseResult(yhjDTO.getPageNum(),yhjDTO.getPageSize(), (int) page.getTotal());
        result.setData(page.getRecords());
        return ResponseResult.okResult(result);
    }
}
